package com.group.www.service.impl;

import com.group.www.dao.impl.IUserInfoDao;
import com.group.www.interfaces.IUserInfo_q;
import com.group.www.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@com.alibaba.dubbo.config.annotation.Service
@Service
public class SimpleIUserinfoService implements IUserInfo_q {

    @Autowired
    private IUserInfoDao iUserInfoDao;

    @Override
    public UserInfo queryUserInfoById(Integer userId) {
        return iUserInfoDao.queryUserInfoById(userId);
    }

    @Override
    public UserInfo queryUserInfo(String username, String userpwd) {
        return iUserInfoDao.queryUserInfo(username,userpwd);
    }

    @Override
    public boolean add(UserInfo user) {
        this.iUserInfoDao.save(user);
        return true;
    }

    @Override
    public boolean update(UserInfo user) {
        this.iUserInfoDao.update(user);
        return true;
    }

    @Override
    public boolean add(Object entity) {
        if(entity instanceof UserInfo){
            this.add((UserInfo)entity);
            return true;
        }
        return false;
    }

    @Override
    public boolean update(Object entity) {
        if(entity instanceof UserInfo){
            this.update((UserInfo)entity);
            return true;
        }
        return false;
    }

    @Override
    public List query() {
        return iUserInfoDao.query();
    }

    @Override
    public boolean delete(Object entity) {
        if(entity instanceof UserInfo){
            this.iUserInfoDao.delete((UserInfo) entity);
        }
        return false;
    }
}
